<?php

/*
Copyright 2007 Benjamin V King

BH Widgets is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

BH Widgets is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with BH Widgets; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

class BH_Spacer_Widget {

	function widget($args) {
		extract($args);
		
		$style = $this->get_attribute('style');
		$width = $this->get_attribute('width');
		$hieght = $this->get_attribute('hieght');
		
		echo "$before_widget";
		echo $this->get_widget_start_tag($args);
		echo "<div style=\"width:${width};hieght:${hieght}${style}\">&nbsp;</div>\n";
		echo $this->get_widget_end_tag($args);
		echo "$after_widget\n";
	}

	function control() {
		$dashed_title = preg_replace("/\s+/", "-", $this->get_name());
	
		$style = $this->get_attribute('style');
		$width = $this->get_attribute('width');
		$hieght = $this->get_attribute('hieght');
		
		if ( $_POST["bh-spacer-submit-$title"] ) {
			$style = stripslashes($_POST["bh-spacer-widget-style-$dashed_title"]);
			$width = stripslashes($_POST["bh-spacer-widget-width-$dashed_title"]);
			$hieght = stripslashes($_POST["bh-spacer-widget-hieght-$dashed_title"]);
			
			$this->set_attribute('style', $style);
			$this->set_attribute('width', $width);
			$this->set_attribute('hieght', $hieght);
		}
	
		echo "<label>Style:</label><input name=\"bh-spacer-widget-style-$dashed_title\" value=\"". $style ."\"/><br/>\n";
		echo "<label>Width:</label><input name=\"bh-spacer-widget-width-$dashed_title\" value=\"". $width ."\"/><br/>\n";
		echo "<label>Hieght:</label><input name=\"bh-spacer-widget-hieght-$dashed_title\" value=\"". $hieght ."\"/><br/>\n";
		echo "<input type=\"hidden\" name=\"bh-spacer-submit-$dashed_title\" value=\"1\" />\n";
	}

}

bh_widgets_register_class('BH_Spacer_Widget');
?>
